# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=pyqt5-sip
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python-sip"
           "${MINGW_PACKAGE_PREFIX}-python-sip4")
replaces=("${MINGW_PACKAGE_PREFIX}-python-sip"
          "${MINGW_PACKAGE_PREFIX}-python-sip4")
pkgver=12.12.2
pkgrel=1
pkgdesc="The sip extension module provides support for the PyQt5 package (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
license=('spdx:GPL-3.0-or-later')
url="https://riverbankcomputing.com/software/pyqt"
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python-wheel"
             "${MINGW_PACKAGE_PREFIX}-cc")
source=(https://pypi.python.org/packages/source/P/PyQt5_sip/PyQt5_sip-${pkgver}.tar.gz)
sha256sums=('10d9bfa9f59f0fd1cad81be187479316ffc95684f573efea94512cb4257d2b17')

prepare() {
  cd "${srcdir}"
  rm -rf python-build-${MSYSTEM} | true
  cp -r "PyQt5_sip-${pkgver}" "python-build-${MSYSTEM}"
}

build() {
  cd python-build-${MSYSTEM}
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

package(){
  cd "${srcdir}"/python-build-${MSYSTEM}
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl
}
